package cn.xinfei.xdecision.engine.runner.service;

import cn.xinfei.xdecision.common.datamodel.DecisionResult;
import cn.xinfei.xdecision.common.dynamic.DynamicDataSourceSwitch;
import cn.xinfei.xdecision.model.DecisionReentryApiRequest;
import com.github.pagehelper.PageInfo;

import java.util.Date;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

public interface DecisionResultService {

    public boolean updateDecisionResultObjectId(String bizId, String decisionId, String ObjectId);

    public boolean updateDecisionResultCodeById(String bizId, String decisionId, String code);

    DecisionResult saveDecisionResultByBizId(DecisionResult decisionResult);

    List<DecisionResult> getDecisionResultByBizId(String bizId,String scene,String engineCode);
    List<DecisionResult> getDecisionResultByBizId(String bizId);

    List<DecisionResult> getDecisionResultByBizIdAndDecisionId(String bizId, String decisionId);


    PageInfo<DecisionResult> getDecisionResultByBizId(DecisionReentryApiRequest decisionReentryApiRequest);
    PageInfo<DecisionResult> getMainRequestIdsByReentryRequest(DecisionReentryApiRequest decisionReentryApiRequest, List<String> states, Date startTime, Date endTime, ConcurrentHashMap<String,Long> processingIds);

    PageInfo<DecisionResult> getRequestIdsByReentryRequest(DecisionReentryApiRequest decisionReentryApiRequest, List<String> states, Date startTime, Date endTime, ConcurrentHashMap<String,Long> processingIds);

    List<DecisionResult> getDecisionResultByDecisionId(String decisionId);
    List<DecisionResult> getDecisionResultByMainDecisionId(String decisionId);
    DecisionResult selectDecisionResultByDecisionId(String bizId,String decisionId);

    DecisionResult upsertDecisionResultByDecisionId(DecisionResult decisionResult,String executorDecisionId,String updateDecisionId) throws Exception;

    DecisionResult saveDecisionResultByDecisionId(DecisionResult decisionResult) throws Exception;

    DecisionResult updateDecisionResultDetailByDecisionId(DecisionResult decisionResult);
}
